package com.example.demo07.entity;

import java.util.List;

public class Response {
    private Integer code;
    private String msg;
    private Object data;

    public Response(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public static Response success(Object data) {
        return new Response
          (200, "请求成功", data);
    }
    public static Response fail(Integer code, String msg){
        return new Response(code, msg, null);
    }

    public static Response ok(List<User> user) {
        return new Response(200, "请求成功", user);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
